package com.qianbei.user.withdrawal;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.qianbei.R;
import com.qianbei.common.utilis.DateUtil;

import java.util.List;


/**
 * 作者:GaoQian on 2016/10/29.
 * 邮箱:gaoqian_zz@163.com
 */

public class WdDetailAdapter extends android.widget.BaseAdapter {
    Context context;
    List<WdDetailBean.DataBean.RecordBean> recordBeanList;


    public WdDetailAdapter(Context context, List<WdDetailBean.DataBean.RecordBean> recordBeanList) {
        this.context = context;
        this.recordBeanList = recordBeanList;
    }


    @Override
    public int getCount() {
        return recordBeanList.size();

    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if (convertView == null) {
            convertView = View.inflate(context, R.layout.kh_item_wddetail, null);
            viewHolder = new ViewHolder();
            viewHolder.mTvItemWdtime = (TextView) convertView.findViewById(R.id.tv_item_wdtime);
            viewHolder.mTvItemWdmoney = (TextView) convertView.findViewById(R.id.tv_item_wdmoney);
            viewHolder.mTvItemWdstatus = (TextView) convertView.findViewById(R.id.tv_item_wdstatus);

            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        viewHolder.mTvItemWdmoney.setText(recordBeanList.get(position).getQuota() + "元");
        String dateStrToString = DateUtil.timeStamp2Date(String.valueOf(recordBeanList.get(position).getAddtime()), "");

        viewHolder.mTvItemWdtime.setText(dateStrToString);
        int status = recordBeanList.get(position).getStatus();
        if (status == 1) {
            viewHolder.mTvItemWdstatus.setText("提现成功");
        } else if (status == 2) {
            viewHolder.mTvItemWdstatus.setText("正在审核");
        } else if (status == 3) {
            viewHolder.mTvItemWdstatus.setText("提现失败");

        }

        return convertView;
    }


    class ViewHolder {
        TextView mTvItemWdtime;
        TextView mTvItemWdmoney;
        TextView mTvItemWdstatus;

    }

}
